<template>
  <div id='TabControl'>
    <div class="title" v-for="(item,index) in tabcontitle" @click="tabconclick(index)">
      <span :class="{active:index === currentindex}">{{item}}</span>
    </div>
  </div>
</template>

<script>
  export default {
    name: 'TabControl',
    data() {
      return {
        currentindex: 0,
        isFixed: false,
      }
    },
    props: {
      tabcontitle: {
        type: Array,
        default() { }
      },
      isfixed: String
    },
    computed: {
      topfixed() {
        return
      }
    },
    components: {},
    methods: {
      tabconclick(index) {
        this.currentindex = index;
        this.$emit('tabconclick', index)
      },
    },
  }
</script>

<style scoped>
  #TabControl {
    display: flex;
    height: 40px;
    line-height: 40px;
  }

  .title {
    flex: 1;
    text-align: center;
  }

  .title span {
    padding: 5px;
  }

  .active {
    color: pink;
    border-bottom: 2px solid pink;
  }
</style>